define(['cookie'], function(cookie) {
    return {

        init: function() {
            //  console.log(1);
            let $login = $('.login_ac');
            // console.log($login);
            //  console.log($('#username'));

            //console.log($username);
            // console.log($password);

            $login.on('click', function() {

                let $username = $('#username').val();
                let $password = $('#passwd').val();
                console.log($username, $password);
                $.ajax({
                    type: 'post',
                    url: 'http://localhost/wmsj/php/login.php',
                    dataType: 'json',
                    data: {
                        user: $username,
                        pass: $password

<<<<<<< HEAD
=======

>>>>>>> last commit
                    }
                }).done(function(data) {
                    if (data) {

                        let yonghu = `${$username}`;
                        cookie.set('users', yonghu, 124);
                        location.href = "index.html";

<<<<<<< HEAD
=======
                        /* ******************************** */





                        /* ************************************************************ */
>>>>>>> last commit
                    } else {
                        alert('用户名密码错误');
                        //cookie.set('users', 0, 124);
                    }

                })






<<<<<<< HEAD
=======


>>>>>>> last commit
            })





            this.blur();



<<<<<<< HEAD
=======



>>>>>>> last commit
        },
        blur: function() {

            $('#username').on('blur', function() {
                console.log($(this).val());

                $(this).val($(this).val());



            });
            $('#passwd').on('blur', function() {
                console.log($(this).val());

                $(this).val($(this).val());


            });



        }







    }
})